/**
 * @System abcs-aspchain
 * @Description: Copyright: Copyright (c) 2018
 * Company: Aspire Technologies
 * @author zhongzifeng
 * @date 2018/11/23 11:29
 * @version V1.0
 */
package com.asp.aspchain.tsttransaction.controller;

import com.asp.aspchain.core.util.AjaxResult;
import com.asp.aspchain.tsttransaction.constants.ErrorCode;
import com.asp.aspchain.tsttransaction.service.EoaCommitService;
import org.apache.log4j.Logger;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @ClassName: CommitTransactionController
 * @Description: TODO(充值交易提交控制类)
 * @author zhongzifeng
 * @date 2018/11/23 11:29
 *
 */
@RestController
@RequestMapping("/tranction/eoa/tst")
public class CommitTransactionController {



    private final static Logger logger = Logger.getLogger(CommitTransactionController.class);

    @Autowired
    private EoaCommitService eoaCommitService;

    /**
     * 充值接口
     * @param json
     * @return
     */
    @PostMapping("/commit")
    public AjaxResult eoaCommit(@RequestBody String json) {

        logger.info("=============EOA-TST-充值接口开始=============");
        logger.info("EOA-TST-充值接口传入参数：" + json);
        //接受前端请求记录内部日志
        AjaxResult ajaxResult = new AjaxResult();
        try{
            ajaxResult = eoaCommitService.eoaCommit(json);
        }catch (Exception e) {
            logger.error("EOA-TST-Commit接口错误："+e.getMessage());
            ajaxResult.setTips("系统内部错误");
            ajaxResult.setMessage("系统内部错误");
            ajaxResult.setStatus(ErrorCode.INTERNAL_ERROR);
        }
        logger.info("=============EOA-TST充值接口结束=============");
        return ajaxResult;
    }
}
